<template>
    <el-submenu :index="item.path" v-loading="item.loading">
        <!-- 有子项且子项不为空 -->
        <template slot="title">
            <i v-if="item.icon" :class="item.icon"></i>
            <span slot="title">{{ item.subName }}</span>
        </template>
        <MenuItem
            v-for="child in item.children"
            :key="child.subName"
            :item="child"
        >
        </MenuItem>
    </el-submenu>
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import { NavData } from './index.vue'
@Component({
    name: 'SubMenu',
    components: { MenuItem: () => import('./MenuItem.vue') },
})
export default class SubMenu extends Vue {
    @Prop()
    item!: NavData
}
</script>

<style scoped lang="less"></style>
